package interface_;

/**
 * @description:
 * @Author yyp
 * @time
 */
public class Interface03 {
    public static void main(String[] args) {
        MysqlDB mysqlDB = new MysqlDB();
        OracleDB oracleDB = new OracleDB();
        Interface03DB interface03DB = new Interface03DB();
        interface03DB.start(mysqlDB);
        interface03DB.start(oracleDB);
    }
}

interface DBInterface{//项目经理
    public void connect();
    public void close();
}

class MysqlDB implements DBInterface{
    public void connect() {
        System.out.println("链接Mysql");
    }
    public void close() {
        System.out.println("Mysql断开");
    }
}

class OracleDB implements DBInterface{
    public void connect() {
        System.out.println("链接Oracle");
    }
    public void close() {
        System.out.println("Oracle断开");
    }
}

class Interface03DB{
    public void start(DBInterface dbInterface){
        dbInterface.connect();
        dbInterface.close();
    }

}
